using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Bludz
{
    class Camera : Singleton<Camera>
    {
        private Matrix view, projection;

        public Camera()
        {
            setupProjection(45, 1, 10000);
            setupView(new Vector3(100, 100, 100), new Vector3(0, 0, 0));
        }

        public void setupProjection(float fov, float near, float far)
        {
            float aspect = (float)GameServer.get().graphics.GraphicsDevice.Viewport.Width /
                (float)GameServer.get().graphics.GraphicsDevice.Viewport.Height;
            projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(fov), aspect, near, far);
        }

        public void setupView(Vector3 pos, Vector3 lookAt)
        {
            view = Matrix.CreateLookAt(pos, lookAt, Vector3.Up);
        }

        public Matrix getView()
        {
            return view;
        }

        public Matrix getProjection()
        {
            return projection;
        }
    }
}
